

score = {
    "张三": {
        "数学": 98,
        "语文": 87,
        "物理": 79
    },
    "李四": {
        "化学": 86,
        "语文": 97,
        "数学": 69
    },
    "王五": {
        "化学": 89,
        "语文": 69,
        "数学": 89
    }
}

def main():
	t1()
	t2()
	t3()

def t1():
	max = 0
	max_person = ""
	for i,j in score.items():
		if j["语文"] >= max :
			max = j["语文"]
			max_person = i
	print(f"语文最高的人是{max_person},分数为{max}")

def t2():
	totals = {i:sum(j.values()) for i,j in score.items()}
	[print(f"{i}的总分为:{j}") for i,j in totals.items()]

def t3():
	totals = [[i, sum(j.values())] for i,j in score.items()]
	sorted_totals = sorted(totals, key=lambda x: x[1], reverse=True)
	for rank, (name, total) in enumerate(sorted_totals, 1):
		print(f"{rank}.{name}: {total}分")

main()